/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sims.io;

import java.sql.Connection;
import java.sql.PreparedStatement;
import sims.databaseconnection.Connector;
import sims.entity.User;

/**
 *
 * @author BinhMV
 */
public class AccountManager {
    private Connection conn;
    
    public String updatePass(String newPass,User user) throws Exception{
        conn = new Connector().connect();
         PreparedStatement request = conn.prepareCall("update users set pass = ? where userId = ?");
            request.setString(1, newPass);
            request.setInt(2, user.getId());
            request.executeUpdate();
        
        conn.close();
        return "Change password sucessfull !";
    }
}
